#!/bin/bash

# postinst script for amd64-microcode
#
# see: dh_installdeb(1)

#set -e

# summary of how this script can be called:
#        * <postinst> \`configure' <most-recently-configured-version>
#        * <old-postinst> \`abort-upgrade' <new version>
#        * <conflictor's-postinst> \`abort-remove' \`in-favour' <package>
#          <new-version>
#        * <postinst> \`abort-remove'
#        * <deconfigured's-postinst> \`abort-deconfigure' \`in-favour'
#          <failed-install-package> <version> \`removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

PATH=/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH

if [ "${BASEDIR:=/}" = "/" ]; then
    BASEDIR=""
else
    BASEDIR_OPT="-b $BASEDIR"
fi

case "$1" in
    configure)
        chown root:sys $BASEDIR/platform/i86pc/ucode
	chown root:sys $BASEDIR/platform/i86pc/ucode/AuthenticAMD
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1020-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1020-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1020-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1020-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1022-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1022-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1022-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1022-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1041-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1041-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1041-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1041-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1043-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1043-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1043-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1043-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1062-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1062-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1062-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1062-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1080-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1080-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1080-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1080-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1081-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/1081-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1081-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/1081-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/10A0-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/10A0-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/10A0-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/10A0-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/2031-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/2031-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/2031-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/2031-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/3010-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/3010-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/3010-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/3010-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/5010-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/5010-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/5010-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/5010-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/5020-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/5020-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/5020-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/5020-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/6012-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/6012-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/6012-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/6012-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/6020-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/6020-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/6020-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/6020-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/6101-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/6101-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/6101-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/6101-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/7001-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/7001-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/7001-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/7001-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/8012-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/8012-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/8012-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/8012-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/8082-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/8082-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/8082-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/8082-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/8310-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/8310-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/8310-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/8310-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/A010-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/A010-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/A010-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/A010-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/A011-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/A011-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/A011-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/A011-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/A012-00 ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/A012-00
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/A012-00"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/A012-00"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/container ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/container
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/container"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/container"
	fi
	if [ "$ZONEINST" = "1" ]; then
	    [ -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/equivalence-table ] && rm -f $BASEDIR/platform/i86pc/ucode/AuthenticAMD/equivalence-table
	else
	    chmod 0444 "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/equivalence-table"
	    chown root:sys "$BASEDIR/platform/i86pc/ucode/AuthenticAMD/equivalence-table"
	fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument '$1'" >&2
        exit 1
    ;;
esac



# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0

